package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

@TableName("t_post")
public class PostBean {
    @TableId(value = "pk_postid",type = IdType.AUTO)
    private Integer id;

    @TableField("p_title")
    private String title;

    @TableField("p_content")
    private String content;

    /**外键 发帖人id*/
    @TableField("fk_userid")
    private Integer userId;

    /**发帖人 */
    @TableField(exist = false)
    private UserBean userBean;

    /**发帖时间 */
    @TableField("p_date")
    private LocalDate date = LocalDate.now();

    /**回帖集合 */
    @TableField(exist = false)
    private List<ReplyBean> replyList;

    /**回帖数量 */
    @TableField(exist = false)
    private Integer num;

    /**外键 频道ID*/
    @TableField("fk_channelid")
    private Integer channelId;

    @TableField(exist = false)
    /**频道对象*/
    private ChannelBean channelBean;

    public PostBean() {
    }

    public PostBean(String title, String content, Integer channelId) {
        this.title = title;
        this.content = content;
        this.channelId = channelId;
    }

    public PostBean(String title, String content, Integer userId , Integer channelId) {
        this.title = title;
        this.content = content;
        this.userId = userId;
        this.channelId = channelId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public UserBean getUserBean() {
        return userBean;
    }

    public void setUserBean(UserBean userBean) {
        this.userBean = userBean;
    }

    public LocalDate getDate() {
        return date;
    }

    public void setDate(LocalDate date) {
        this.date = date;
    }

    public List<ReplyBean> getReplyList() {
        return replyList;
    }

    public void setReplyList(List<ReplyBean> replyList) {
        this.replyList = replyList;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public ChannelBean getChannelBean() {
        return channelBean;
    }

    public void setChannelBean(ChannelBean channelBean) {
        this.channelBean = channelBean;
    }

    @Override
    public String toString() {
        return "PostBean{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", userId=" + userId +
                ", userBean=" + userBean +
                ", date=" + date +
                ", replyList=" + replyList +
                ", num=" + num +
                ", channelId=" + channelId +
                ", channelBean=" + channelBean +
                '}';
    }
}
